﻿using MediatR;
using RBAC.LuFang.API.Application.Command.RoleCommand;
using RBAC.LuFang.Domin.Services;

namespace RBAC.LuFang.API.Application.CommandHandlers.RoleHandler
{
    public class RoleDeleteCommandHandler:IRequestHandler<RoleDeleteCommand,int>
    {
        private readonly IRoleService _roleService;
        //构造函数
        public RoleDeleteCommandHandler(IRoleService roleService)
        {
            _roleService = roleService;
        }

        public async Task<int> Handle(RoleDeleteCommand request, CancellationToken cancellationToken)
        {
            return await _roleService.DelRole(request.Id);
        }
    }
}
